package ${packageName}.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import ${packageName}.pojo.dto.${upperDataKey}AddRequest;
import ${packageName}.pojo.dto.${upperDataKey}EditRequest;
import ${packageName}.pojo.dto.${upperDataKey}QueryRequest;
import ${packageName}.pojo.vo.${upperDataKey}VO;
import ${packageName}.service.${upperDataKey}Service;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;

/**
 * ${dataName}接口
 *
 */
@Api(tags = "${dataName}接口")
@RestController
@RequestMapping("/${dataKey}")
@Slf4j
public class ${upperDataKey}Controller {

    @Resource
    private ${upperDataKey}Service ${dataKey}Service;


    // region 增删改查
    /**
     * 新增${dataName}
     * @param ${dataKey}AddRequest
     */
    @ApiOperation("新增${dataName}")
    @PostMapping("/add")
    public void add${upperDataKey}(@RequestBody ${upperDataKey}AddRequest ${dataKey}AddRequest) {
        ${dataKey}Service.add(${dataKey}AddRequest);
    }

    /**
    * 编辑${dataName}
    * @param ${dataKey}EditRequest
    */
    @ApiOperation("编辑${dataName}")
    @PutMapping("/edit")
    public void edit${upperDataKey}(@RequestBody ${upperDataKey}EditRequest ${dataKey}EditRequest) {
         ${dataKey}Service.edit(${dataKey}EditRequest);
    }


    /**
    * 分页获取${dataName}列表
    * @param ${dataKey}QueryRequest
    */
    @ApiOperation("分页获取${dataName}列表")
    @GetMapping("/list/page")
    public IPage<${upperDataKey}VO> selPage (${upperDataKey}QueryRequest ${dataKey}QueryRequest) {
        return ${dataKey}Service.selPage(${dataKey}QueryRequest);
    }

    /**
     * 删除${dataName}
     * @param id
     */
    @ApiOperation("删除${dataName}")
    @DeleteMapping("/delById/{id}")
    public void delById(@PathVariable("id") String id) {
        ${dataKey}Service.delById(id);
    }
    // endregion
}
